<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/1/6
 * Time: 10:52
 */
require "../vendor/autoload.php";
$configparams['logging'] = true;
$configparams['logPath'] = __DIR__.'/elasticsearch.log';
$configparams['logLevel'] = Psr\Log\LogLevel::INFO;
$configparams['logPermission'] = 0664;
$configparams['hosts'] = ['192.168.51.124:9200']; // IP + Port
$client = new Elasticsearch\Client($configparams);
$result = $client->get( [ 'index' => 'megacorp', 'type' => 'employee','id' => 1 ] );
$params['body'] = array(
	'query' => array(
		'match' => array(
			'content' => 'sports'
		)
	),
	'highlight' => array(
		'fields' => array(
			'content' => (object) array()
		)
	)
);
$results = $client->search($params);
var_dump($results);